from django.http import HttpResponse
from django.shortcuts import render_to_response
import datetime

def hello(request):
    return HttpResponse("hello world!")

def current_datetime(request):
    now = datetime.datetime.now()
    html = "<html><body>It is now %s.</body></html>" % now
    return HttpResponse(html)

def time_plus(request, hours):
    try:
        offset = int(hours)
    except ValueError:
        raise Http404()
    dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
    html = "<html><body>In %s hour(s), it will be %s.</body></html>" % (offset, dt)
    return HttpResponse(html)


def new_datetime(request):
    now = datetime.datetime.now()
    hour_offset = 0
    next_time = now + datetime.timedelta(hours=hour_offset)
    #return render_to_response('current_datetime.html', locals())
    return render_to_response('date_temp.html', locals())

def foxdiary_main(request):
    return render_to_response('foxdiary_template.html', locals())
